<?php

    class CicpHelloWorldHandler implements Cicp_Handler_Interface
{
    function initGraph($x, $y, $z)
    {
        $graph = new Cicp_Graph();
        $graph->setPosition($x, $y, $z+1);
        $node = $graph->createNode();
        $node->setTitle("Hello, World!");
        $node->setDimensions(.5, 1, 0);

        // create a menu
        $menu = new Cicp_Graph_Menu;

        // Add a button "Green!"
        $menu->addButton('Green!');

        // Add menu to graph
        $graph->addMenu($menu);

        // Assign menu to the node
        $node->assignMenu($menu);

        return $graph;
    }

    function menuChoice(Cicp_Graph $graph, Cicp_Graph_Node $node, Cicp_Graph_Menu $menu, $menuButtonLabel)
    {
        // this function should not be called, as the graph provides
        // no menus yet... but if so, throw exception
        throw new Exception('Method menuChoide called ( ' . __FILE__ . ').');
    }
}